using System.Collections.Generic;
using UnityEngine;


[CreateAssetMenu(fileName = "FriendSoliderRandomTarget-获得随机的这个棋子的友方士兵", menuName = "Skill/Target/FriendSoliderRandomTarget-获得随机的这个棋子的友方")]
public class FriendSoliderRandomTarget : TargetSelectorBase
{
    public override List<Chess> SelectTargets(Chess chess, GameEvent e)
    {
        List<Chess> friendChess = new List<Chess>();
        foreach (var c in ChessManager.GetInstance().chessList)
        {
            if (c.GetChessSide() == chess.GetChessSide() && c != chess && c.chessDate.chessType == ChessType.Soldier)
            {
                friendChess.Add(c);
            }
        }

        return friendChess.Count == 0 ? null : new List<Chess>() { friendChess[Random.Range(0, friendChess.Count)] };
    }
}